Copyright: RegEdit Prof - Copyright Nicola Viganò 1998
Citation: 'RegEdit Prof - Copyright Nicola Viganò 1998'


Overview
RegEdit Ocx Family

RegEdit Ocx Family is a group of professional controls that give you a simple way to access at the Windows Configuration registry.

I’m sure you will find the right RegEdit Ocx control for you.

 RegEdit Prof: for professional users who need a complete access at the registry, with no limits.

 RegEdit Standard: for standard users who need a normal access at the registry, without compromises.

 RegEdit Light: for users who want just read and write the registry, free of charge!

Before starting use one of these control please read carefully the Warranty Disclaimer and Use Limitations.

Copyright © Nicola Viganò 1997/98 - All rights reserved

Email: <guru@ntt.it>

Internet: http://members.tripod.com/~RegEditProf/

Warning

The registry is fundamental to the proper functioning of your system. You should only change registry entries if you know what you are doing, and are confident of the results.

Improper use of RegEdit Prof can cause problems with your system that may even result in your having to reinstall Windows. Always make a backup of your registry before you make any changes


The registry is the centralized database used by Windows and newer Windows applications to store configuration information. It contains settings for system hardware, software, and network applications. Programs can freely modify and retrieve this information as necessary.


Warranty Disclaimer and Use Limitations

IMPORTANT - READ CAREFULLY:

By installing, copying, or otherwise using this software product, you agree to be bound by the terms of this Warranty Disclaimer and Use Limitations. If you do not agree to its terms, promptly delete all copies of the software and all accompanying material.

Warranty Disclaimer

The software is provided as is without warranty, in Shareware form, without time limitations. In no event shall Nicola Viganò be liable for any consequential, incidental, direct, indirect, special, punitive, or other damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of this agreement or the use of or inability to use any control of the RegEdit Ocx Family, even if Nicola Viganò has been advised of the possibility of such damages.

Your license will be LOST if any modifications have been applied to the license keyfile [REditLic.reg] of RegEdit Prof and RegEdit Standard.

Use Limitations

You can free redistribute this control with your applications, only if it is not exclusively a Registry Editor. In this case you have to contact the author.

In any case you can't redistribute the registered version of RegEdit Prof or RegEdit Standard.


Benefits and costs
Registration benefits and costs

 RegEdit Prof

Registering benefits

There are many benefits registering RegEdit Prof. Check the list out:

•	No About Box will be showed during design and run time.

•	You will receive a special e-mail address to get support, suggestions and examples.

•	With the registered version you will also receive a special "Registry Tips and Tricks" help file: how to register a file extension, to add your personal command to the explorer contextual menu and much more. (When available)

•	Any upgrade will be free.

So, you can see that "registering is convenience".

Registering costs

Registering costs are:

one to five licenses..	$ 49.95

more licenses .........	email me

You need one license for each terminal you use to develop with RegEdit Prof. Royalty are free.

Refer to "How to Register" for information about registration.

 RegEdit Standard

Registering benefits

Here are benefits registering RegEdit Standard. Check the list out:

•	No About Box will be showed during design and run time.

•	You will receive a special e-mail address to get support, suggestions and examples.

•	Any upgrade will be free.

Registering costs

Registering costs are:

one to five licenses..	$ 29.95

more licenses .........	email me

You need one license for each terminal you use to develop with RegEdit Prof. Royalty are free.

Refer to "How to Register" for information about registration.

 RegEdit Light

Registering costs

No registering costs for this control: it is FREE. Royalty are free.


How to register

There are several ways to register RegEdit Prof or RegEdit Standard.

•	Order by regular mail: send your registration fee by regular mail to

Nicola Viganò

Via Quattro Spade, 22

37121  Verona

Italy, Europe

Don't worry about sending cash in the mail, just fold it into a sheet of paper so that you can't see the money through the envelope.

Don’t forget to indicate: 1. your e-mail address; 2. your name and company name; 3. your address, 4. the name of the control you want to buy

You will receive a special discount of $ 4.95 if you choose this way to register.

•	Order on-line at the RegSoft using the following URL:

RegEdit Prof: https://www.regsoft.com/cgi-bin/reg_it_offsite.pl?7857

RegEdit Standard: https://www.regsoft.com/cgi-bin/reg_it_offsite.pl?8108

If you register on-line, you should receive your registered version within 1 or 2 days - often it's possible within some hours !!

•	Order by check: simply enter your personal data and payment data into the software registration form (see URL's above), print your order form and Mail it along with a check in US Dollars to :

RegSoft.com
6595-G Roswell Road
Suite 732
Atlanta, GA 30328

•	Order by International Transfer: it is very important that the bank papers reflect your identity: 1. your e-mail address; 2. your name and company name; 3. your address, 4. the name of the control you want to buy

You have to add $ 5.00 (the amount the bank charges me for currency exchange).

The payment is to be effected through: BANCA S.PAOLO DI BRESCIA

Branch of: SEDE DI VERONA

Swift: BSPLIT22VRN

Account n.: 4256

To: Nicola Viganò

•	Order by Phone by calling the US Toll Free number 1-877-REGSOFT (international orders please call 770-497-9126).

•	Order by Fax: simply enter your personal data and payment data into the software registration form (see URL's above), then find your "print" icon on your browser and print your order form to your fax directly or to your printer for a manual fax transmission. You can Fax your order form to the US number: 770-497-9234.


 Introduction to the Registry

If you launch Microsoft® RegEdit you will see a window like this:

Always make a backup of your registry before you make any changes.

Move your mouse on the picture and click to see the different sections

In the left panel are the root keys and sub keys: you can think of them just like folders and subfolders.

In the right panel are the values and each value has its value data for the selected SubKey.

For the above example, the root key is HKEY_LOCAL_MACHINE. The sub key is \Network\Logon. There is a value called username. The value data is guru.

Root Key

There are six root keys and you can't change them.

HKEY_CLASSES_ROOT

This key displays information about OLE and associated mappings to support drag-and-drop operations.

HKEY_CURRENT_USER

This points to a branch of HKEY_USERS for the currently logged on user.

HKEY_LOCAL_MACHINE

This contains computer specific information including installed hardware and software.

HKEY_USERS

This contains information about users that have logged on to the computer.

HKEY_CURRENT_CONFIG

This key points to a branch of HKEY_LOCAL_MACHINE \ Config and has information such as display fonts and printers.

HKEY_DYN_DATA

This key points to a branch of HKEY_LOCAL_MACHINE that has information about Plug and Play devices. Consider that you can’t read or write this key under WinNT.

Sub Key

Any root key has its sub keys and you can modify them. Sub keys contain other sub keys and values.

Value name

The value name identify a specific value. Two value names with the same name can't exist into the same key.

Value

Many types of value can exist. The principal are five:

String

Expanded string

Binary

DWord

Multi-string

Refer to Value property for more information.

A special value is the Default value. It is a string and the value name can't be changed.

More information about registry are available into "Registry Tips and Tricks" help file. Refer to "Registration benefits and costs" for more information.


Root key


Sub key


Default value


Value name


Value


GlobalKeyPath Property
 Property GlobalKeyPath

See also	Example	Properties and Method

Returns or sets a string with the default root key and sub key path.

Syntax

object.GlobalKeyPath [= string]

The syntax of GlobalKeyPath property is:

Section	Description

string	A value that specify the root key and the sub key path. It must start with a root key.

Remarks

There are no difference between using GlobalKeyPath or hKey and SubKeyPath. Remember only that the GlobalKeyPath property must start with a root key. You will see that modifying one of these properties the others will change.

GlobalKeyPath is thought to let you copy and paste sub keys from MS RegEdit (or others registry editors).


Example

This example adds the value "This is my setting" under HKEY_CURRENT_USER\ MySubKey1\ MySubKey2 path using GlobalKeyPath property.

RegEdit1.GlobalKeyPath = "HKEY_CURRENT_USER\MySubKey1\MySubKey2"

RegEdit1.ValueType = StringType

RegEdit1.ValueName = "MyString"

RegEdit1.Value = "This is my setting"

RegEdit1.SetValue


hKey Property
 Property hKey

See also	Example	Properties and Method

Sets the default root key.

Syntax

object.hKey [= root key]

The syntax of hKey property is:

Section	Description

root key	A value how is indicated into the "Parameters" section.

Parameters

The possible parameters of hKey are:

Constant	Value

HKEY_CLASSES_ROOT	-2147483648
HKEY_CLASSES_USER	-2147483647
HKEY_LOCAL_MACHINE	-2147483646
HKEY_USERS	-2147483645
HKEY_CURRENT_CONFIG	-2147483643
HKEY_DYN_DATA (Not available under WinNT)	-2147483642

Remarks

Note that the values are changed from RegEdit Light, due to be compatible with the API's values.

If you were using the constant name with RegEdit Light you will not have problems using RegEdit Prof. On the other hand if you have used the numerical values you have to change them.


Example

This example adds the value "This is my setting" under HKEY_CURRENT_USER\ MySubKey1\ MySubKey2 path using hKey and SubKeyPath properties.

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\ MySubKey2"

RegEdit1.ValueType = StringType

RegEdit1.ValueName = "MyString"

RegEdit1.Value = "This is my setting"

RegEdit1.SetValue


SubKeyPath Property
 Property SubKeyPath

See also	Example	Properties and Method

Sets the default sub key path.

Syntax

object.SubKeyPath [= string]

The syntax of SubKeyPath property is:

Section	Description

string	A string that specifies the sub key path.


UndoEnabled Property
 Property UndoEnabled

See also	Example	Properties and Method

Returns or sets if the Undo method is enabled.

Syntax

object.UndoEnabled [= boolean]

The syntax of ValueName property is:

Section	Description

boolean	A value that specify if Undo method is enabled or not. True: the Undo method is enabled, this slow the methods that can be undo. False (default): the Undo method is not enabled


Value Property
 Property Value

See also	Example	Properties and Method

Returns or sets the value.

Syntax

object.Value [= variant]

The syntax of Value property is:

Section	Description

variant	The value you want to access.

Remarks

There are five different type of value:

String	String values hold alphanumeric text data such as the path to an application on disk.
Expanded string	The expanded string value type is used for string data that includes environment variables within the string. Expanded strings flag environment variables by enclosing them in a pair of percent (%) symbols. RegEdit Prof is written to recognize expanded strings, so it can "expand" the environment variable to substitute the current value of the environment variable. Thus, if an expanded string value is saved like this: "The path for temporary file storage is %TEMP%" RegEdit Prof by reading this value would expand %TEMP% to the current value, resulting in: "The path for temporary file storage is C:\WINDOWS\TEMP"
Binary	Binary values can be any length, and are represented using hexadecimal digits. It has to be in hexadecimal format with two numbers without spaces (ex.:"0AEF002B" and not "A EF 0 2B") in string format.
DWord	Numeric ("Dword") values are 32 bit values that can be entered as long values. You can use both decimal (max: 4294967295) and exadecimal (max: FFFFFFF) format, the second with “&H” notation (see VB help for more information).
Multi-string	Multi-strings are binary values that comprise more than one string value. These can be used to store several string values, such as a list of file extensions, together in a single registry entry. RegEdit Prof lets you view and enter these as regular text, rather than as hexadecimal digits. Individual strings in the multi-string value should be separated by a vertical line (ASCII value: 124).

There are several reasons a programmer might want to use expanded and multi-string types:

•	efficiency: multi-strings can store several text strings in a single binary registry value.

•	organization: RegEdit Prof can expand this kind of string with the local computer environment variable

•	security: both multi-strings and expanded strings appear as hexadecimal notation when viewed with Microsoft's RegEdit that is included with Windows. This protects the data from casually prying eyes.


Environment variables store various global settings used by the operating system and other applications. These settings can be changed; environment variables store the current settings. Typical environment variables used by DOS include PROMPT (specifies how the DOS prompt will look), TEMP (specifies the folder to use for temporary program file storage), and PATH (specifies a list of folders through which the operating system will search in order to find an executable program that is entered on the command line).

To see your currently-defined environment variable settings, open a DOS window, and type SET at the command prompt.


Example

This example shows you the five different types of values.

String value:

RegEdit1.ValueName = "MyString"

RegEdit1.ValueType = StringType

RegEdit1.Value = "This is my setting"

Expanded string value:

RegEdit1.ValueName = "MyEpandedString"

RegEdit1.ValueType = ExpandedStringType

RegEdit1.Value = "This the path %PATH%."

Binary value:

RegEdit1.ValueName = "MyBinary"

RegEdit1.ValueType = BinaryType

RegEdit1.Value = "0AEF002B"

DWord value:

RegEdit1.ValueName = "MyDWord"

RegEdit1.ValueType = DWordType

RegEdit1.Value = 12345    'or   RegEdit1.Value = &H3039

Multi-string value:

RegEdit1.ValueName = "MyMultistring"

RegEdit1.ValueType = MultiStringType

RegEdit1.Value = "You can use to store tables" & chr$(124) & "and many other values"


ValueName Property
 Property ValueName

See also	Example	Properties and Method

Sets the name of the value.

Syntax

object.ValueName [= string]

The syntax of ValueName property is:

Section	Description

string	A value that specifies the name of the value you want to access. If you specify an empty string you will access to the default value of the default key.


ValueType Property
 Property ValueType

See also	Example	Properties and Method

Sets the type of the value.

Syntax

object.ValueType [= value type]

The syntax of ValueType property is:

Section	Description

value type	A value how is indicated into the "Parameters" section

Parameters

The possible parameters of ValueType are:

Constant	Value

StringType	1
ExpandedStringType	2
BinaryType	3
DWordType	4
MultiStringType	7

Remarks

See the Property Value for more information about using the different types.

You need to set this property only if you are setting value(s). All others methods don't need to know the ValueType.

Note that the values are changed from RegEdit Light, due to be compatible with the API's values.

If you were using the constant name with RegEdit Light you will not have problems using RegEdit Prof. On the other hand if you have used the numerical values you have to change them.


AboutBox Method
 Method AboutBox

See also	Example	Properties and Method

Shows the About Box of RegEdit Prof.

Syntax

object.AboutBox


AddExtCommand Method
 Method AddExtCommand

See also	Example	Properties and Method

Add an Explorer contextual menu command for a specific file extension

Syntax

object.AddExtCommand Extension, CommandName, CommandDescription, Command [, Predefined, Overwrite]

The syntax of AddExtCommand method is:

Section	Description

Extension	The extension for witch you want to add a command.
CommandName	Name of the command you are adding, like "open" or "print". You can use the name you prefer, but consider that there are some commands, such "open" or "print", that are automatically translated with international release of Windows. In that case you have to specify an empty string for CommandDescription.
CommandDescription	Description of the command that appears into the Explorer contextual menu. You can use mnemonic (&).
Command	Command line for your application. Refer to Example for more information.
Predefined	(Optional) Specifies if the command has to be the predefined command choosing it double clicking the file. The possible values are: False: (predefinite) not predefined. True: predefined.
Overwrite	(Optional) Specifies if an existent command, with the same CommandName, has to be overwritten. The possible values are: False: (predefinite) to not overwrite a command. True: to overwrite an existent command.

Remarks

For your safety reasons, you can add or overwrite commands only to extensions registered with RegEdit Prof. In any case you can manage the others using standard RegEdit Prof methods.

For more information about managing command parameters refer to Command Function into VB help.


Example

This example shows you how to add and remove an Explorer contextual menu command for a specific file extension. Imagine you want to add, or remove, a command to open a file -“.xxx” extension- with your application -MyApp.exe-.

Add:

'You have to put '%1' between two apices if you want to manage long file name.

RegEdit1.AddExtCommand "xxx","open","","C:\MyFolder\MyApp.exe %1"

Remove:

RegEdit1.DelExtCommand "xxx","open"


Backup and Restore Methods
 Method Backup and Restore

See also	Example	Properties and Method

Backups/restores the entire registry.

Syntax

object.Backup

object.Restore

Remarks

These methods are useful to prevent any damage to the configuration registry.

Before you make changes to the registry, if you are not sure of the results, make a backup.

Note that the Restore method will not erase the keys and values you have added, but simply restore all original elements.


CopyKey Method
 Method CopyKey

See also	Example	Properties and Method

Copies a key to a declared position.

Syntax

object.CopyKey NewhKey, NewKeyPath

The syntax of CopyValue method is:

Section	Description

NewhKey	Specifies the destination root key.
NewKeyPath	Specifies the destination sub key path and the name of the key.

Remarks

To declare the source key you have to use hKey and SubKeyPath (or GlobalKeyPath) properties.

All subkeys of the source key will be copied.


Example

This example shows you how to use the three methods CopyKey, MoveKey and RenameKey, to copy/move the subkey MySubKey2 from HKEY_CURRENT_USER\MySubKey1 to HKEY_LOCAL_MACHINE\MySubKey3 and to rename the same key to MySubKey4

Copy:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

RegEdit1.CopyKey HKEY_LOCAL_MACHINE, "MySubKey3\MySubKey2"

Move:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

RegEdit1.MoveKey HKEY_LOCAL_MACHINE, "MySubKey3\MySubKey2"

Rename:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

RegEdit1.CopyKey "MySubKey4"


CopyValue Method
 Method CopyValue

See also	Example	Properties and Method

Copies a value to a declared position.

Syntax

object.CopyValue NewhKey, NewKeyPath, NewValueName [,Overwrite]

The syntax of CopyValue method is:

Section	Description

NewhKey	Specifies the destination root key.
NewKeyPath	Specifies the destination sub key path.
NewValueName	Specifies the destination value name.
Overwrite	(Optional) Specifies if an existent value has to be overwritten. The possible values are: False: (predefinite) to not overwrite an existent value. True: to overwrite an existent value.

Remarks

To declare the source value you have to use hKey, SubKeyPath (or GlobalKeyPath) and ValueName properties.


Example

This example shows you how to use the three methods CopyValue, MoveValue and RenameValue, to copy/move the value MyValue1 from HKEY_CURRENT_USER\MySubKey1\MySubKey2 to HKEY_LOCAL_MACHINE\MySubKey3 and to rename the same value to MyValue2

Copy:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

RegEdit1.ValueName = "MyValue1"

RegEdit1.CopyValue HKEY_LOCAL_MACHINE, "MySubKey3","MyValue1"

Move:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

RegEdit1.ValueName = "MyValue1"

RegEdit1.MoveValue HKEY_LOCAL_MACHINE, "MySubKey3","MyValue1"

Rename:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

RegEdit1.ValueName = "MyValue1"

RegEdit1.RenameValue "MyValue2"


Count Method
 Method Count

See also	Example	Properties and Method

Determines how many subkeys or values are into the default key.

Syntax

object.Count(CountType[, CountMode])

The syntax of Count method is:

Section	Description

CountType	Specifies what you need to count. The possible values are: CountSubKeys: to count all sub keys under the default key. CountValues: to count all values under the default key.
CountMode	(Optional) Specifies if you need to include all sub keys under the default key. The possible values are: ExcludeSubKey: (predefinite) to exclude all sub keys. IncludeSubKey: to include all sub keys.

Return value

Long


Example

This example shows you how to use the Count method to count all keys and values of MySubKey2 under HKEY_CURRENT_USER\MySubKey1 sub key, excluding all others sub keys.

' This will contain the total amount of keys

Dim NumberOfKeys as Long

' This will contain the total amount of values

Dim NumberOfValues as Long

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

NumberOfKeys = RegEdit1.Count(CountSubKeys, ExcludeSubKey)

NumberOfValues = RegEdit1.Count(CountValues, ExcludeSubKey)


DeleteKey Method
 Method DeleteKey

See also	Example	Properties and Method

Deletes the default key and all its descendants.

Syntax

object.DeleteKey

Remarks

Pay attention! All values and keys, under the key you are deleting, will be deleted.


DeleteValue Method
 Method DeleteValue

See also	Example	Properties and Method

Deletes the default value.

Syntax

object.DeleteValue


Example

This example shows you how to use DeleteKey and DeleteValue methods.

The first procedure will delete the key MySubKey2 under HKEY_CURRENT_USER\MySubKey1, the second will delete the value MyValue1, under HKEY_CURRENT_USER\MySubKey1

Remember that all values and keys, under the key you are deleting, will be deleted.

Delete a key:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1\MySubKey2"

RegEdit1.DeleteKey

Delete a value:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MySubKey1"

RegEdit1.ValueName = "MyValue1"

RegEdit1.DeleteValue


DelExtCommand Method
 Method DelExtCommand

See also	Example	Properties and Method

Add an Explorer contextual menu command for a specific file extension

Syntax

object.DelExtCommand Extension, CommandName

The syntax of AddExtCommand method is:

Section	Description

Extension	The extension for witch you want to add a command.
CommandName	Name of the command you are deleting, like "open" or "print".

Remarks

For your safety reasons, you can delete commands only to extensions registered with RegEdit Prof. In any case you can manage the others using standard RegEdit Prof methods.


Export and Import Methods
 Methods Export and Import

See also	Example	Properties and Method

Exports/imports part of the registry in/from a text format file.

Syntax

object.Export PathName [, AllRegistry, Comment]

object.Import PathName

The syntax of Export and Import methods is:

Section	Description

PathName	Specifies the file name with its path. The predefinited extension is ".reg".
AllRegistry	(Optional and Export only) Specifies if export all the registry or only the default root key and subkey. The possible values are: True: all the registry will be exported. False: (predefinite) only the default root key and subkey will be exported.
Comment	(Optional and Export only) Specifies a comment to be added to the exported file. Individual lines should be separated by a vertical line (ASCII value:124).

Remarks

To declare the key to export you have to use hKey and SubKeyPath (or GlobalKeyPath) properties.

All subkeys and values of the default key will be exported.

Pay attention importing unknown ".reg" files.

Don't use the Export and Import methods to backup the registry, there are the Backup and Restore methods.


Example

With this example you will see how to export and import the entire HKEY_CURRENT_USER key to/from the file "C:\MyRegistryFile.reg", adding a comment.

After you have exported a .REG file, you can open and see it with NotePad. Double clicking you will import it into the registry.

Export:

Dim Comment as string

Comment = "First line of comment|Second line of comment "

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath=""

'.REG extension is predefined, but you can use the extension you prefer

RegEdit1.Export "C:\MyRegistry", False, Comment

Import:

RegEdit1.Import "C:\Import.reg"


Find Method
 Method Find

See also	Example	Properties and Method

Returns a variant containing the result of a search.

Syntax

object.Find(StringToFind, FindMode, FindKeyPath, FindValueName[, Reserved, AllRegistry, ProgressBarHWnd])

The syntax of Find method is:

Section	Description

StringToFind	Specifies the string you are looking for.
FindMode	Specifies what kind of search you prefer. The possible values are: PartialString: to find all items that contain the string you are looking for WholeString: to find all items that are exactly the string you are looking for. Note that case sensitive is always enabled.
FindKeyPath	Specifies if the search will be done into all sub keys names. The possible values are: True: the search will be done also into the subkeys names False: the search will exclude the subkeys names
FindValueName	Specifies if the search will be done into all value names. The possible values are: True: the search will be done also into the values names False: the search will exclude the values names
FindValue	Specifies if the search will be done into all values. The possible values are: True: the search will be done also into the values False: the search will exclude the values
Reserved	Reserved parameter for future use. It must be zero.
AllRegistry	(Optional) Specifies if the search will be done into all the registry or only into the default root key and subkey path. The possible values are: True: the search will be done into all the registry False: (predefinite) the search will be done only into the default root key and subkey path.
ProgressBarHWnd	(Optional) Specifies the handle of a ProgressBar. See the ProgressBar Note for more information.

Return value

Variant

The return value contains an array (n*2) that contains all information about the result of the search:

Array(index1, index2)

Index1: the index of the current element

Index2: the index of the element information, as specify below

0  root key 	(eg. HKEY_CURRENT_USER)

1  sub key path 	(eg. .Default\Control Panel\Appearance)

2  value name	(eg. Current)

3  value 	(eg. Windows standard)

4  value type	(eg. 1 for StringType)

Note that if the value name is an empty string, it refers to the "Predefinited value".

To understand how to manipulate this array please refer to the Array Note.

Remarks

Note that the search can need some time to be completed. During this time your application will be got stuck. In this way if you know the sub key where the search has to be done is better you do a search only in this key. For big research use a progress bar (for more information see ProgressBar Note).

In any case you will note that a big research is faster if it is done with MS RegEdit or Symantec® Norton Registry Editor.


Example

This example shows you how you can use the Find method.

It will look for all value names and values, under HKEY_CURRENT_USER root key, that contains the partial string "win". The search results will showed into a listbox, named List1.

' This variable will contain all mach found

Dim FoundElements as variant

' A counter

Dim i as long

'The mouse pointer is set as hourglass

Screen.MousePointer = vbHourGlass

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath=""

'The search starts

FoundElements = RegEdit1.Find("win", PartialString, False, True, True)

'If no elements found show a message

If IsEmpty(FoundElements) Then

MsgBox "No elements found"

else

'else fill the listbox

For i = LBound(FoundElements) to UBound(FoundElements)

List1.AddItem "Element " & CStr(i)

List1.Additem "Path: " & FoundElements(i,0) & "\" & FoundElements(i,1)

List1.Additem "Value: " & FoundElements(i,2) & " = " & FoundElements(i,3)

List1.Additem ""

Next i

End If

'The mouse pointer is set as normal

Screen.MousePointer = vbNormal


ForceWriting Method
 Method ForceWriting

See also	Example	Properties and Method

Writes all the attributes of the default root key into the registry.

Syntax

object.ForceWriting

Remarks

Calling this method excessively can have a negative effect on an application's performance. An application should only call ForceWriting if it requires absolute certainty that registry changes are on disk. If you don't know whether a ForceWriting call is required, it probably isn't.


GetAllKeys Method
 Method GetAllKeys

See also	Example	Properties and Method

Returns the subkeys of the default registry key.

Syntax

object.GetAllKeys

Return value

Variant

The return value contains an array (n*1) that contains all subkey names.

Array(index)

Index: the index of the current element

To understand how to manipulate this array please refer to the Array Note.


GetAllValues Method
 Method GetAllValues

See also	Example	Properties and Method

Returns the values of the default registry key.

Syntax

object.GetAllKeys

Return value

Variant

The return value contains an array (n*2) that contains all values information.

Array(index1, index2)

index1: the index of the current element

index2: the index of value information, as specify below

0  value name

1  value

2  value type

To understand how to manipulate this array please refer to the Array Note.


GetValue Method
 Method GetValue

See also	Example	Properties and Method

Reads the default value.

Syntax

object.GetValue

Remarks

The value will be available into the Value property. It is not necessary you indicate the value type.


LastAction Method
 Method LastAction

See also	Example	Properties and Method

Returns a number that identify the type of the last action that can be undone

Syntax

object.LastAction

Remarks

Compare the returned value with this table:

Value	Action
0	Nothing to undo
160 to 162	A value has been set
163	A value has been deleted
176 or 177	A group of values has been set
192	A value has been renamed
193 to 195	A value has been moved
196 to 198	A value has been copied
208	A key has been set
209	A key has been deleted
224	A group of keys has been set
240	A key has been renamed
241	A key has been moved
242	A key has been copied

For your curiosity

Some actions have more than a value because there are more than one method to do them.


MoveKey Method
 Method MoveKey

See also	Example	Properties and Method

Moves a key to a declared position.

Syntax

object.MoveKey NewhKey, NewKeyPath

The syntax of CopyValue method is:

Section	Description

NewhKey	Specifies the destination root key.
NewKeyPath	Specifies the destination sub key path.

Remarks

To declare the source key you have to use hKey and SubKeyPath (or GlobalKeyPath) properties.

All subkeys of the source key will be moved.


MoveValue Method
 Method MoveValue

See also	Example	Properties and Method

Moves a value to a declared position.

Syntax

object.MoveValue NewhKey, NewKeyPath, NewValueName [,Overwrite]

The syntax of MoveValue method is:

Section	Description

NewhKey	Specifies the destination root key.
NewKeyPath	Specifies the destination sub key path.
NewValueName	Specifies the destination value name.
Overwrite	(Optional) Specifies if an existent value has to be overwritten. The possible values are: False: (predefinite) to not overwrite an existent value. True: to overwrite an existent value.

Remarks

To declare the source value you have to use hKey, SubKeyPath (or GlobalKeyPath) and ValueName properties.


RegisterExtension Method
 Method RegisterExtension

See also	Example	Properties and Method

Register a file extension, to be recognized, and managed, by Explorer contextual menu.

Syntax

object.RegisterExtension Extension, Description, DefaultIcon [,Overwrite]

The syntax of RegisterExtension method is:

Section	Description

Extension	The extension you want to register.
Description	Description of type of file, that will appear under Type column into Explorer.
DefaultIcon	Name of the file that contains the icon for your extension. If the file contains more than one icon you have to specify also the number of the icon you want use, starting by zero. Refer to Example for more information.
Overwrite	(Optional) Specifies if a registered extension has to be overwritten. The possible values are: False: (predefinite) to not overwrite registered extension. True: to overwrite registered extension.


Example

This example shows you how to register and unregister a file extension. Imagine you want to register, or unregister, the extension “.xxx”.

Register:

'Note that this type of file will appear with the 14th icon of Shell32.dll file.

RegEdit1.RegisterExtension "xxx","This is my archive type","Shell32.dll,13"

Unregister:

RegEdit1.UnregisterExtension "xxx"


RenameKey Method
 Method RenameKey

See also	Example	Properties and Method

Renames a key.

Syntax

object.RenameKey NewKeyPath

The syntax of CopyValue method is:

Section	Description

NewKeyPath	Specifies the new name of the key.

Remarks

To declare the key to rename you have to use hKey and SubKeyPath (or GlobalKeyPath) properties.


RenameKey Method
 Method RenameValue

See also	Example	Properties and Method

Renames a value.

Syntax

object.RenameValue NewValueName

The syntax of CopyValue method is:

Section	Description

NewValueName	Specifies the new value name.

Remarks

To declare the value to rename you have to use hKey, SubKeyPath (or GlobalKeyPath) and ValueName properties.


Replace Method
 Method Replace

See also	Example	Properties and Method

Replaces all the items found with a string.

Syntax

object.Replace(StringToFind, ReplaceWith, FindMode, FindKeyPath, FindValueName[, Reserved, AllRegistry, ProgressBarHWnd])

The syntax of Replace method is:

Section	Description

StringToFind	Specifies the string you want to be replaced.
ReplaceWith	Specifies the string you want to replace with.
FindMode	Specifies what kind of search you prefer. The possible values are: PartialString: to find all items that contain the string you are looking for WholeString: to find all items that are exactly the string you are looking for. Note that case sensitive always is enabled.
FindKeyPath	Specifies if the search will be done into all sub keys names. The possible values are: True: the search will be done also into the subkeys names False: the search will exclude the subkeys names
FindValueName	Specifies if the search will be done into all value names. The possible values are: True: the search will be done also into the values names False: the search will exclude the values names
FindValue	Specifies if the search will be done into all values. The possible values are: True: the search will be done also into the values False: the search will exclude the values
Reserved	Reserved parameter for future use. It must be zero.
AllRegistry	(Optional) Specifies if the search will be done into all the registry or only into the default root key and subkey path. The possible values are: True: the search will be done into all the registry False: (predefinite) the search will be done only into the default root key and subkey path.
ProgressBarHWnd	(Optional) Specifies the handle of a ProgressBar. See the ProgressBar Note for more information.

Return value

Long

The number of items replaced.

Remarks

Note that the search can need some time to be completed. During this time your application will be got stuck. In this way if you know the sub key where the search has to be done is better you do a search only in this key. For big research use a progress bar (for more information see ProgressBar Note).

In any case you will note that a big research is faster if it is done with MS RegEdit or Symantec® Norton Registry Editor.


SetAllKeys Method
 Method SetAllKeys

See also	Example	Properties and Method

Writes an array of keys.

Syntax

object.SetAllKeys SubKeyArray

The syntax of SetAllKeys method is:

Section	Description

SubKeyArray	Specifies an array of keys to be written.

Remarks

To specify the keys to set simply create an array of strings. If you specify sub keys they will be created.


Example

This example shows you how you can set and get multiple keys:

Set:

' This is a string array that contains all keys structure

Dim KeysArray(0 to 2) as String

' Here you define your keys structure

KeysArray(0) = "MyKey1"

KeysArray(1) = "MyKey2\MyKey3\MyKey4"

KeysArray(2) = "MyKey5"

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = ""

RegEdit1.SetAllKeys KeysArray

Get:

' This is a variant array that will contains all keys

Dim KeysArray as Variant

Dim i as Long

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = ""

KeysArray = RegEdit1.GetAllKeys

'If no elements found show a message

If IsEmpty(KeysArray) Then

MsgBox "No keys found"

else

'else fill the listbox

For i = LBound(KeysArray) to UBound(KeysArray)

List1.AddItem "Element " & CStr(i)

List1.Additem "Path: " & KeysArray(i)

List1.Additem ""

Next i

End If


SetAllValues Method
 Method SetAllValues

See also	Example	Properties and Method

Writes an array of values.

Syntax

object.SetAllValues ValueArray [,SetMode]

The syntax of SetAllValues method is:

Section	Description

ValueArray	Specifies an array of values to be written.
SetMode	(Optional)Specifies the mode you what to set values. The possible values are: OpenAndCreate: (predefinite) if the sub key doesn't exist, it will be created OpenOnly: if the sub key doesn't exist an error will be returned

Remarks

To specify the values to set, simply create an array of variant.

This array must contains n*3 elements:

Array(index1, index2)

index1: number of values you have to set (n)

index2: is the index of value information, as specify below

0  value name

1  value: refer to the Value property.

2  value type: refer to the ValueType property.


Example

This example shows you how you can set and get multiple values.

Set:

' This is a string array that contains all values you have to set.

Dim ValuesArray(0 to 1, 0 to 2) as String

' Define your first value

ValuesArray(0, 0) = "MyValue1"

ValuesArray(0, 1) = 1234

ValuesArray(0, 2) = dWordType

' Define your second value

ValuesArray(1, 0) = "MyValue2"

ValuesArray(1, 1) = "StringValue"

ValuesArray(1, 2) = StringType

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MyKey"

RegEdit1.SetAllValues ValuesArray

Get:

' This is an array of variant that will contains all values

Dim ValuesArray as Variant

Dim i as Long

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MyKey"

ValuesArray = RegEdit1.GetAllValues

'If no elements found show a message

If IsEmpty(ValuesArray) Then

MsgBox "No values found"

else

'else fill the listbox

For i = LBound(ValuesArray) to UBound(ValuesArray)

List1.AddItem "Element " & CStr(i)

List1.Additem "Value: " & ValuesArray( i, 0) & " = " & ValuesArray( i, 1)

List1.Additem "Value type: " & ValuesArray( i, 2)

List1.Additem ""

Next i

End If


SetKey Method
 Method SetKey

See also	Example	Properties and Method

Writes the default key.

Syntax

object.SetKey

Remarks

You can indicate a key and its descendent into the SubKeyPath. Any key will be created.


Example

This example shows you how to use SetKey method to create the key MyKey1 with a sub key MyKey2, under the root key HKEY_CURRENT_USER.

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MyKey1\MyKey2"

RegEdit1.SetKey


SetValue Method
 Method SetValue

See also	Example	Properties and Method

Writes the default value.

Syntax

object.SetValue SetMode

The syntax of SetValue method is:

Section	Description

SetMode	(Optional)Specifies the mode you what to set a value. The possible values are: OpenAndCreate: (predefinite) if the sub key doesn't exist, it will be created OpenOnly: if the sub key doesn't exist an error will be returned

Remarks

You have to set the ValueType property before set a value.


Example

This example shows you how to use SetValue and GetValue methods to create and read a value, under the key MyKey

Set:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MyKey"

RegEdit1.ValueName = "MyString"

RegEdit1.ValueType = StringType

RegEdit1.Value = "This is my setting"

RegEdit1.SetValue

Get:

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = "MyKey"

RegEdit1.ValueName = "MyString"

RegEdit1.GetValue

'Now the value is available into Value property.


SystemInfo Method
 Method SystemInfo

See also	Example	Properties and Method

Returns the system information you need.

object.SystemInfo(InfoType)

The syntax of SystemInfo method is:

Section	Description

InfoType	Specifies the information you need
	Value	Description	Example
	OS	Operative system	Windows 95
	ProductID	Product Id	12345-OEM-1234567-12345
	VersionNumber	OS Version number	4.00.1111 B
	RegisteredOwner	Owner's name	Your name
	RegisteredOrganization	Organization name	Your organization
	WinDir	Windows folder	C:\Windows
	SysDir	System folder	C:\Windows\System
	TempDir	Temporary folder	C:\Windows\Temp
	ProgramFilesDir	Program files folder	C:\Program Files
	CommonFilesDir	Common files folder	C:\Program Files\Common Files
	ComputerName	Computer name	Your computer name
	UserName	User name	Your user login
	UserLanguage	User Language	Your user language

Return Value

String

Returns the information you need in string format.

Note

Do you think some other information could be useful ?

Email me. If I can, I will add it to the SystemInfo list.


Undo Method
 Method Undo

See also	Example	Properties and Method

Undoes last actions.

Syntax

object.Undo UndoSteps

The syntax of Undo method is:

Section	Description

UndoSteps	(Optional) Specifies how many actions undo. If you don't specify anything, will be undone the last action. You can undo the last twenty actions. If this parameter is set to zero all undo information will be deleted. You don't need to do it to clear RAM, because undo information are written on your hard disk.

Remarks

If there are more than one instance of RegEdit Prof running at the same moment, they will have different undo information each one. When you terminate an instance all undo information (of that instance) will be deleted. This happen also if you set UndoEnabled to false.

Take easy using this method, because RegEdit Prof considers to be the only registry modifier.

For example:

if you set a new subkey with RegEdit Prof, you add a value into this subkey with Microsoft RegEdit, and you Undo the RegEdit Prof last action, the subkey will be deleted, even if there is a new value.

This "problem" is solved using RegEdit Prof to add that value to the subkey created.

This is the list of the actions you can undo:

SetValue	SetKey
SetAllValues	SetAllKeys
DeleteValue	DeleteKey
RenameValue	RenameKey
MoveValue	MoveKey
CopyValue	CopyKey

In particular you can't undo Replace, Import, Restore and Undo methods.


UnregisterExtension Method
 Method UnregisterExtension

See also	Example	Properties and Method

Unregister a file extension.

Syntax

object.UnregisterExtension Extension

The syntax of UnregisterExtension method is:

Section	Description

Extension	The extension you want to unregister.

Remarks

For your safety reasons, you can unregister only extensions registered with RegEdit Prof. In any case you can manage the others using standard RegEdit Prof methods.


VerifyExistence Method
 Method VerifyExistence

See also	Example	Properties and Method

Verifies the existence of the default key or value.

Syntax

object.VerifyExistence(VerifyType)

The syntax of VerifyExistence method is:

Section	Description

VerifyType	Specifies what you need to verify the existence. The possible values are: VerifyKey: to verify the existence of a key VerifyValueName: to verify the existence of a value name

Return Value

Boolean

True: the element exists

False: the element doesn't exist


Example

This example shows you how to use VerifyExistence method to verify if the sub key Recent, under HKEY_CURRENT_USER\.Default\Network, exists.

' If the key exists this value will be True

Dim KeyExists as Boolean

RegEdit1.hKey = HKEY_CURRENT_USER

RegEdit1.SubKeyPath = ".Default\Network\Recent"

KeyExists = RegEdit1.VerifyExistence(VerifyKey)


 Errors list

60001 - The configuration registry database is corrupt.

The configuration registry is corrupt.

60002 - The configuration registry key is invalid.

The configuration registry key doesn’t exist or is invalid.

60003 - The configuration registry key could not be opened

The configuration registry key could not be opened.

60004 - The configuration registry key could not be read.

The configuration registry key could not be read.

60005 - The configuration registry key could not be written.

The configuration registry key could not be written.

60006 - Not enough storage is available to complete this operation.

Not enough storage is available to complete this operation.

60007 - The parameter is incorrect.

Check if the parameter you have modified is correct or not.

60008 - Access is denied.

The configuration registry access is denied.

60009 - The configuration registry key does not exist.

The configuration registry key does not exist.

60010 - The SubKeyPath property is too long.

A registry key must not be longer than 255 chars.

60100 - No enough actions to undo.

No enough actions to undo.

60101 - Undo method is disabled because the UndoEnabled property is false.

Undo method is disabled because the UndoEnabled property is false.

60110 - The registry file can't be imported because MS RegEdit can't be find.

You need MS RegEdit to import a registry file.

60111 - The registry file can't be exported because MS RegEdit can't be find.

You need MS RegEdit to export a registry file.

60120 - The registry can't be restored because the backup file doesn't exist.

The registry can't be restored because the backup file doesn't exist.

60130 - Can’t move a key into itself.

Can’t move a key into itself.

60131 - Can’t copy a key into itself.

Can’t copy a key into itself.

60132 - The source key and the destination key are the same.

The source key and the destination key are the same.

60133 - The configuration registry value does not exist.

The configuration registry value does not exist.

60134 - The destination key already exists.

The destination key already exists.

60134 - The destination value name already exists.

The destination value name already exists.

60140 - Reserved parameter must be zero.

Reserved parameter must be zero.

60150 - Can’t replace a string with another that contains the first.

Can’t replace a string with another that contains the first.

60259 - No more data is available.

No more data is available.

60999 - I'm sorry but this method is not still available.

The method is not still available.

61000 - RegEdit Prof License missing or wrong.

RegEdit Prof License missing or wrong.

60000 + other number - A generic error occurs using RegEdit Prof.

A generic error occurs. Contact the me signaling the error number and describing the error situation.


Array Note

Some methods return a variant that contains a vector or an array. This one contains the information you need, and it is very simply to manipulate.

This example shows you the right way to do that.

This is your variant.

Dim MyArray as Variant

These are some variables, that will contains the information

Dim Info1 as String, Info2 as Long

This is a counter

Dim i as Long

Now the variant contains the array (or vector) you're looking for.

MyArray = object.SomeMethod

You can verify also if the MyArray is empty or not

If IsEmpty(MyArray) Then Exit Sub

This cycle starts from the first element of the array and ends on the last element.

For i = LBound(MyArray) to UBound(MyArray)

Info1 now contains the first information of the current array element

Info1 = MyArray( i, 0)

Info2 now contains the second information of the current array element

Info2 = MyArray( i, 1)

Your code

.

.

.

Next i

If you need to manipulate a vector simple use one index, instead of two or more.

To better understand you can use the VB5 command Local Window under View menu to see the structure of the array (vector).


Progress Bar Note

There are several methods that needs some time to be completed.

To help you to entertain your utilizers, RegEdit Prof is enabled to work with a standard VB Progress Bar. In this way you can place a PB on a form of your application, than call the RegEdit Prof method, sending also the PB handle, and wait for RegEdit to end its work. The PB will be filled by RegEdit.

Unfortunately the filling is not really proportional to the percent of the work done, like Explorer when copy a file ;-) .

Note that you have to use a standard ProgressBar, contained into the "Microsoft Windows Common Controls".

See this example to understand better:

Suppose you have to search "MyString" in all the registry. Place a button and a standard progress bar on a form and pass its handle to the Find method.

Sub Command1_Click()

Dim MyArray as variant

' Passing the handle of a PB it will be filled by RegEdit Prof.

MyArray = RegEdit1.Find( True, "MyString", WholeString, True, True, True , 0, True, ProgressBar1.hWnd)

End Sub

Don't abuse of this possibility. If the method is fast, the effect will be not very kind.


Properties and Methods: alphabetical list

Properties and Methods: logical list

Properties

GlobalKeyPath

hKey

SubKeyPath

UndoEnabled

Value

ValueName

ValueType

Methods

AboutBox

AddExtCommand

Backup and Restore

CopyKey

CopyValue

Count

DeleteKey

DeleteValue

DelExtCommand

Export and Import

Find

ForceWriting

GetAllKeys

GetAllValues

GetValue

LastAction

MoveKey

MoveValue

RegisterExtension

RenameKey

RenameValue

Replace

SetAllKeys

SetAllValues

SetKey

SetValue

SystemInfo

Undo

UnregisterExtension

VerifyExistence


Properties and Methods: logical list

Properties and Methods: alphabetical list

Properties

hKey

SubKeyPath

GlobalKeyPath

ValueType

ValueName

Value

UndoEnabled

Methods

AboutBox

SetValue

SetAllValues

GetValue

GetAllValues

DeleteValue

RenameValue

MoveValue

CopyValue

SetKey

SetAllKeys

GetAllKeys

DeleteKey

RenameKey

MoveKey

CopyKey

Count

VerifyExistence

ForceWriting

Find

Replace

LastAction

Undo

Export and Import

Backup and Restore

SystemInfo

RegisterExtension

UnregisterExtension

AddExtCommand

DelExtCommand